package com.lyz.dataStructure.考研上机编程题;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 0:07
 * @Description:
 **/

import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/9/18 0:07
 *@Description:
 **/
public class 求最大最小值 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       while (sc.hasNext()){
           int n = sc.nextInt();
           int[] arr = new int[n];
           for(int i = 0;i<n;i++){
               arr[i] = sc.nextInt();
           }
           int max = returnMax(arr);
           int min = returnMin(arr);
           System.out.println(max+" "+min);
       }
    }

    public static int returnMax(int[] arr ){
        int n = arr.length;
        int max = arr[0];
        for(int i =0;i<n;i++){
            if(arr[i]>max){
                max = arr[i];
            }
        }
       return max;
    }
    public static int returnMin(int[] arr ){
        int n = arr.length;
        int min = arr[0];
        for(int i =0;i<n;i++){
            if(arr[i]<min){
                min = arr[i];
            }
        }
        return min;
    }
}
